package com.moodincode.taskcenter.script;

/**
 * @author moodincode 函数工具类
 */
public class FuncUtil {

    public static String toFuncScript(String script,String functionName,String ... argsName){
        StringBuffer sb=new StringBuffer("function ");
        sb.append(functionName).append("(");
        if(argsName.length>0){
            for (int i = 0; i < argsName.length; i++) {
                if(i>0){
                    sb.append(",");
                }
                sb.append(argsName[i]);
            }
        }
        sb.append(") {").append(script).append("}");
        return sb.toString();

    }
}
